<template>
  <section class="page-container">
    <div v-for="cate of cateList" :key="cate.name">
      <div class="cate-name">{{ cate.name }}</div>
      <div class="cate-list">
        <div v-for="pkg of cate.pkgs" :key="pkg.name" class="list-item" @click="go(pkg)">
          <div class="title">{{ pkg.title }}</div>
          <div class="logo"><img :src="pkg.logo" /></div>
        </div>
      </div>
    </div>
  </section>
</template>

<script lang="ts" setup>
  import { useRouter } from 'vue-router';
  import cateList from './config';

  const router = useRouter();

  function go(pkg) {
    router.push({ path: `/package/${pkg.name}` });
  }
</script>
<style lang="less" scoped>
  .page-container {
    width: 100%;
    overflow-x: hidden;
  }
  .cate-name {
    font-size: 18px;
    line-height: 32px;
    font-weight: bold;
    margin-bottom: 16px;
  }
  .cate-list {
    display: flex;
    flex-wrap: wrap;
    width: calc(100% + 24px);
    overflow-x: hidden;
    .list-item {
      cursor: pointer;
      width: 370px;
      box-sizing: border-box;
      margin: 0 24px 24px 0;
      padding: 0;
      color: #000000d9;
      font-size: 14px;
      font-variant: tabular-nums;
      line-height: 1.5715;
      list-style: none;
      font-feature-settings: tnum;
      position: relative;
      background: #fff;
      border-radius: 2px;
      transition: all 0.3s;
      border: 1px solid #f0f0f0;
      &:hover {
        box-shadow: 0 2px 8px #00000026;
      }

      .title {
        height: 48px;
        line-height: 48px;
        margin-bottom: -1px;
        padding: 0 24px;
        color: #000000d9;
        font-weight: 500;
        font-size: 16px;
        background: transparent;
        border-bottom: 1px solid #f0f0f0;
        border-radius: 2px 2px 0 0;
      }
      .logo {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 180px;
        img {
          max-width: 330px;
          max-height: 140px;
        }
      }
    }
  }
</style>
